package com.canyou.controller;

import com.canyou.model.Employee;
import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * 登录验证
 * 
 * @created cgz 2012-12-15
 */
public class LoginValidator extends Validator {

	protected void validate(Controller controller) {
		validateRequiredString("name", "login_error_msg", "* 请输入用户名和密码！");
		validateRequiredString("password", "login_error_msg", "* 请输入用户名和密码！");
	}

	protected void handleError(Controller controller) {
		controller.keepModel(Employee.class);
		if (getActionKey().equals("/login"))
			controller.render("/login.jsp");
	}
}
